package org.duanyu.shopping_search_service.listener;

import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.duanyu.shopping_common.service.SearchService;
import org.duanyu.shopping_search_service.service.SearchServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

//监听删除商品
@Service
@RocketMQMessageListener(topic = "del_goods_queue",consumerGroup = "del_goods_queue")
public class DelGoodsService implements RocketMQListener<Long> {

    @DubboReference
    private SearchService searchService;

    @Override
    public void onMessage(Long id) {
        System.out.println("删除商品");
        searchService.delete(id);
    }
}
